#pragma once
#include <iostream>
#include <vector>
#include <qvector.h>
#include <QWidget>
#include <qfile.h>
#include <qjsondocument.h>
#include <qjsonarray.h>
#include <qjsonobject.h>
#include<qcryptographichash.h>
#include <QJsonParseError>
#include "item.h"
#include "team.h"
template<typename T>
QJsonArray toJsonArray(const QVector<T>& data);
template<typename T>
QVector<T> fromJsonArray(const QJsonArray& array);
class MyData
{
public:
	MyData();
	~MyData();
	int getItemNum1();
	int getItemNum2();
	int getTeamNum();
	void setItemNum1(int num);
	void setItemNum2(int num);
	void setTeamNum(int num);
	void addBoyItem(boyItem& item);
	void addGirlItem(girlItem& item);
	void addTeamItem(team& t);
	void clearBoyItems();
	void clearGirlItems();
	void clearTeams();
	//void setBoyItems(const vector<boyItem>&);
	//void setGirlItems(const vector<girlItem>&);
	//void setTeamItems(const vector<team>&);
	QVector<boyItem>& getBoyItems();
	QVector<girlItem>& getGirlItems();
	QVector<team>& getTeams();
	bool writeDateToJson();
	bool readJsonDate(QString filename);
	QVector<double> getThirdRankCount1();
	QVector<double> getFirstRankCount1();
	QVector<double> getThirdRankCount2();
	QVector<double> getFirstRankCount2();
private:
	quint16 teamNum;
	quint16 itemNum1;
	quint16 itemNum2;
	QVector<boyItem> boyItems;
	QVector<girlItem> girlItems;
	QVector<team> teams;
};

